﻿<?php
$v_date = date('d/m/Y');
$v_customer_record_id = 0;
if(isset($_REQUEST['hdn_customer_record_id'])){
	$v_customer_record_id = $_REQUEST['hdn_customer_record_id'];
}
$v_edit_mode = 1;
if(isset($_REQUEST['hdn_edit_mode'])){
	$v_edit_mode = intval($_REQUEST['hdn_edit_mode']);
}
if(isset($_REQUEST['hdn_worktype'])) {
	$v_worktype = $_REQUEST['hdn_worktype'];
}else{
	$v_worktype = "";
}

$v_customer_name= "";
if(isset($_REQUEST['hdn_customer_name'])){
	$v_customer_name = $_REQUEST['hdn_customer_name'];
}
$v_customer_card_id = "";
if(isset($_REQUEST['hdn_customer_card_id'])){
	$v_customer_card_id = $_REQUEST['hdn_customer_card_id'];
}

$v_list_xml_tag = "";
if(isset($_REQUEST['hdn_list_xml_tag'])){
	$v_list_xml_tag = $_REQUEST['hdn_list_xml_tag'];
}
$v_list_xml_value = "";
if(isset($_REQUEST['hdn_list_xml_value'])){
	$v_list_xml_value = $_REQUEST['hdn_list_xml_value'];
}
$v_staff_id = $_SESSION['staff_id'];

//echo htmlspecialchars($v_xml_str);
//cac file chua cau truc cua bang
$v_table_struct_xml_file = "../../xml/".$v_recordtype_filter."/cau_truc_bang_don_xin_cap_phep.xml";
$v_formfield_xml_file = "../../xml/".$v_recordtype_filter."/cac_dong_cua_don_xin_cap_phep.xml";
if (file_exists($v_table_struct_xml_file) && file_exists($v_table_struct_xml_file)){
	$v_table_struct_xml_string = _read_file($v_table_struct_xml_file);
	$v_formfield_xml_string = _read_file($v_formfield_xml_file);
}else{
	$v_table_struct_xml_file = "../../xml/other/cau_truc_bang_don_xin_cap_phep.xml";
	$v_formfield_xml_file = "../../xml/other/cac_dong_cua_don_xin_cap_phep.xml";
	$v_init_xml_file = "../../xml/other/khoi_tao_thong_tin_nguoi_dang_ky.xml";
	$v_table_struct_xml_string = _read_file($v_table_struct_xml_file);
	$v_formfield_xml_string = _read_file($v_formfield_xml_file);
}
$v_table_struct_xml_string = _read_file($v_table_struct_xml_file);
$v_formfield_xml_string = _read_file($v_formfield_xml_file);

$v_init_xml_file = "../../xml/".$v_recordtype_filter."/khoi_tao_thong_tin_nguoi_dang_ky.xml";
if (file_exists($v_init_xml_file)){
	$v_init_xml_string = _read_file($v_init_xml_file);
}else{
	$v_init_xml_file = "../../xml/other/khoi_tao_thong_tin_nguoi_dang_ky.xml";
	$v_init_xml_string = _read_file($v_init_xml_file);
}
$v_init_xml_string = _read_file($v_init_xml_file);

//Lay du lieu tu database
if ((trim($v_code)!="") || ($v_record_id <> 0)){
	$v_customer_record_id = $arr_single_record['PK_CUSTOMER_RECORD'];
	$v_code = $arr_single_record['C_CODE'];
	$v_input_date = $arr_single_record['C_INPUT_DATE'];
	$v_receiving_date = $arr_single_record['C_RECEIVING_DATE'];
	$v_status_of_receiving = $arr_single_record['C_STATUS_OF_RECEIVING'];
	if ($v_status_of_receiving!=1){
		$v_receiving_date = "";
	}
	$v_message = $arr_single_record['C_MESSAGE'];
	$v_xml_str = $arr_single_record['C_RECEIVED_RECORD_XML_DATA'];
}else{
	$v_edit_mode = 1;
	$v_customer_record_id = 0;
	if (_CONST_AUTOMATIC_RECORD_CODE_GENERATE){
		$v_code = onegate_generate_record_code_net($v_recordtype_filter);
	}else{
		$v_code = "";
	}
	$v_input_date = "";
	$v_receiving_date = "";
	$v_status_of_receiving = 0;
	$v_xml_str = '<?xml version="1.0" encoding="UTF-8"?><root><data_list></data_list></root>';
	if (isset($_SESSION['citizen_id']) && !is_null($_SESSION['citizen_id'])){
		$v_xml_str = init_register_infomation($v_init_xml_string);
	}
}
$v_readonly = "";
if (_CONST_AUTOMATIC_RECORD_CODE_GENERATE){
	$v_readonly = "readonly";
}
//Duong dan den hop hien thi lich
$v_url_path_calendar = '"'.$_ISA_LIB_URL_PATH.'isa-calendar/"';
//So ngay xu ly doi voi moi loai ho so
$v_process_date = 0;
for ($i=0;$i < sizeof($_SESSION['recordtype']);$i++){
	if ($_SESSION['recordtype'][$i]['PK_RECORDTYPE']==$v_recordtype_filter){
		$v_process_date = $_SESSION['recordtype'][$i]['C_PROCESS_DATE'];
		break;
	}
}
$v_current_year = date("Y");
//Kiem tra xem loai cong viec la gi
if (($v_check_worktype == "APPROVING")||($v_check_worktype == "OFFICIAL_RECEIVE")){
	$v_edit_mode = 0;
}

//echo htmlspecialchars($v_table_struct_xml_string); exit;
//Doc va ghi ra tieu de cua form

$table_struct_rax = new RAX(); 
$table_struct_rec = new RAX(); 
$table_struct_rax->open($v_table_struct_xml_string);
$table_struct_rax->record_delim = 'common_para';
$table_struct_rax->parse();
$table_struct_rec = $table_struct_rax->readRecord(); 
$table_struct_row = $table_struct_rec->getRow();
//$v_form_title = $table_struct_row["form_title"];
$v_form_title = CONST_REGISTOR_IDENTITY_STEP3_TITLE;
if (!is_null($v_title) && $v_title!=""){
	 $v_form_title = $v_title;
}
$v_first_col_width = $table_struct_row["first_col_width"];
$v_second_col_width = (100-$v_first_col_width)."%";
$v_js_file_name = $table_struct_row["js_file_name"];
$v_js_function  = $table_struct_row["js_function"];
///Begin//Form
$v_html_string = '<script src="../js-record/'.$v_js_file_name.'"></script>';
//Begin//Bang chua cac thanh phan cua form
$v_html_string = $v_html_string . "<table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr>";
$v_html_string = $v_html_string . "<td class='large_title'>".$v_form_title."</td>";
$v_html_string = $v_html_string . "</tr></table>";
//Bang chua cac bin hidden
$v_html_string = $v_html_string . "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>";
$v_html_string = $v_html_string . "<form action='index.php' method='post' name='f_dsp_single_record'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_list_xml_tag' value=''>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_list_xml_value' value=''>";
$v_html_string = $v_html_string . "<input type='hidden' name='fuseaction' value=''>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_customer_record_id' value='".$v_customer_record_id ."'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_recordtype_filter' value='".$v_recordtype_filter ."'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_received_date_filter' value='".$v_receive_date_filter ."'>";
$v_html_string = $v_html_string . "<input type='hidden' name='fuseaction_back' value='".$fuseaction_back."'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_worktype' value='$v_worktype'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_page' value='$v_page'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_edit_mode' value='$v_edit_mode'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_code' value='$v_code'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_customer_name' value='$v_customer_name'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_customer_card_id' value='$v_customer_card_id'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_approving_type' value='APPROVING'>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_xml_str' value='$v_xml_str'>";
//---- VuNH fix bug - date: 11072007 ------------
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_deleted_exist_file_id_list' value=''>";
$v_html_string = $v_html_string . "<input type='hidden' name='hdn_deleted_new_file_id_list' value=''>";
//---- End VuNH ---------------------------------
$v_html_string = $v_html_string . "</td></tr></table>";
//Doc cac dong cua form	
$table_struct_rax = new RAX(); 
$table_struct_rec = new RAX(); 
$table_struct_rax->open($v_table_struct_xml_string);
$table_struct_rax->record_delim = 'row';
$table_struct_rax->parse();
$table_struct_rec = $table_struct_rax->readRecord(); 
//Bang chua cac dong cua form
$v_html_string = $v_html_string . "<table width='100%' class='form_table1'  border='0' cellspacing='0' cellpadding='0'><tr><td>";
///Begin///Bang chua cac dong co dinh cua ho so
$v_html_string = $v_html_string . "<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
$v_html_string = $v_html_string . "<col width='20%'><col width='30%'><col width='35%'><col width='15%'>";

$v_html_string = $v_html_string . "<tr style='display:none'><td class='normal_label'>".CONST_RECORD_CODE_LABEL."<small class='normal_starmark'>*</small></td><td><input type='text' name='txt_code' class='normal_textbox' $v_readonly style='width:93%' value='$v_code' optional='true' message = '".CONST_RECORD_CODE_MESSAGE."' onKeyDown='change_focus(document.forms(0),this)'></td></tr>";

if ($v_customer_record_id>0){
	$v_html_string = $v_html_string . "<tr><td class='normal_label'>".CONST_RECORD_CODE_LABEL;
	$v_html_string = $v_html_string . "</td><td class='normal_label'>".$v_code;
	$v_html_string = $v_html_string . "</td><td class='normal_label'>".CONST_INPUT_DATE_LABEL;
	$v_html_string = $v_html_string . "</td><td class='normal_label'>"._yyyymmdd_to_ddmmyyyy($v_input_date);
	$v_html_string = $v_html_string . "</td></tr>";
	$v_html_string = $v_html_string . "<tr><td class='normal_label'>".CONST_STATUS_OF_RECEIVING_LABEL;
	$v_html_string = $v_html_string . "</td><td class='normal_label'>".Get_text_from_array($arr_status_of_record_net,'0','0','1', $v_status_of_receiving);
	//$v_html_string = $v_html_string . "</td><td class='normal_label'>".CONST_RECEIVING_DATE_LABEL;
	if($v_status_of_receiving != 9)	 // kiem tra trang thai ho so; khi tiep nhan chinh thuc thi no la 9, thi ko hien dong ngay hen dem ho so goc den nua
	{ 
		$v_html_string = $v_html_string . "</td><td class='normal_label'>".CONST_RECEIVING_DATE_LABEL;
	  	$v_html_string = $v_html_string . "</td><td class='normal_label'>"._yyyymmdd_to_ddmmyyyy($v_receiving_date);
    	}

	//$v_html_string = $v_html_string . "</td><td class='normal_label'>"._yyyymmdd_to_ddmmyyyy($v_receiving_date);
	$v_html_string = $v_html_string . "</td></tr>";
	$v_html_string = $v_html_string . "<tr><td class='normal_label'>Th&#244;ng b&#225;o";
	$v_html_string = $v_html_string . "</td><td class='normal_label' colspan='3'>".$v_message;
	$v_html_string = $v_html_string . "</td></tr>";
	if ($v_check_worktype == "REGISTER"){
		$v_html_string = $v_html_string . "<tr><td class='normal_label'>".CONST_WARNING_CONTENT_LABEL;
		$v_html_string = $v_html_string . "</td><td class='normal_label' colspan='4'><textarea name='txt_warning_content' readonly class='normal_textarea' optional='true' style='width:100%' rows='3'>".$v_message."</textarea>";
		$v_html_string = $v_html_string . "</td></tr>";
	}
	
	$v_html_string = $v_html_string . "<tr><td colspan='10'><hr width='100%' color='#66CCFF' size='1'></td></tr>";
}
$v_html_string = $v_html_string . "<tr><td class='normal_label' colspan='10' align='center'>".CONST_REPUBLIC_LABEL;
$v_html_string = $v_html_string . "</td></tr>";
$v_html_string = $v_html_string . "<tr><td class='normal_label' colspan='10' align='center'>".CONST_FREEDOM_LABEL;
$v_html_string = $v_html_string . "</td></tr>";
$v_html_string = $v_html_string . "<tr><td class='normal_label' colspan='10' align='center'>------------------------";
$v_html_string = $v_html_string . "</td></tr>";
$v_html_string = $v_html_string . "<tr><td class='very_large_value' colspan='10' align='center'>";
$v_html_string = $v_html_string . Get_text_from_array($_SESSION['recordtype'],'PK_RECORDTYPE','PK_RECORDTYPE','C_NAME', $v_recordtype_filter);
$v_html_string = $v_html_string . "</td></tr>";
$v_html_string = $v_html_string . "<tr><td class='small_title' colspan='10' style='text-align:center'>".CONST_RESPECTFULLY_LABEL.$_ISA_OWNER_NAME;
$v_html_string = $v_html_string . "</td></tr>";
$v_html_string = $v_html_string . "</table>";
///End///Bang chua cac dong co dinh cua ho so
//echo htmlspecialchars($v_xml_str);
while ($table_struct_rec) { 
	$table_struct_row = $table_struct_rec->getRow();
	$v_have_line_before = $table_struct_row["have_line_before"];
	$v_col_number = $table_struct_row["col_number"];
	$v_tag_list = $table_struct_row["tag_list"];
	$v_row_id = $table_struct_row["row_id"];
	$arr_tag = explode(",", $v_tag_list);
	if ($v_have_line_before=="true"){
		$v_html_string = $v_html_string . "<table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr>";
		$v_html_string = $v_html_string . "<td><hr width='100%' color='#66CCFF' size='1'></td>";
		$v_html_string = $v_html_string . "</tr></table>";
	}
	//Bang chua mot dong cua form
	$v_html_string = $v_html_string . "<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
	$v_html_table = "";
	$v_html_tag = "";									
	for($i=0;$i < sizeof($arr_tag);$i++){
		$formfield_rax = new RAX(); 
		$formfield_rec = new RAX(); 
		$formfield_rax->open($v_formfield_xml_string);
		$formfield_rax->record_delim = $arr_tag[$i];
		$formfield_rax->parse();
		$formfield_rec = $formfield_rax->readRecord(); 
		$formfield_row = $formfield_rec->getRow(); 
		$v_label = $formfield_row["label"];
		$v_type = $formfield_row["type"];
		$v_dataformat = $formfield_row["data_format"];
		$v_width = $formfield_row["width"];
		$v_row = $formfield_row["row"];
		$v_max = $formfield_row["max"];
		$v_min = $formfield_row["min"];
		$v_maxlength = $formfield_row["maxlength"];
		$v_note = $formfield_row["note"];
		$v_tooltip = $formfield_row["tooltip"];
		$v_message = $formfield_row["message"];
		$v_optional = $formfield_row["optional"];
		$v_xml_tag_in_db = $formfield_row["xml_tag_in_db"];
		$v_default_value = $formfield_row["default_value"];
		$v_js_function_list = $formfield_row["js_function_list"];
		$v_js_action_list = $formfield_row["js_action_list"];
		$v_readonly_in_edit_mode = $formfield_row["readonly_in_edit_mode"];
		if($v_edit_mode==0){
			$v_readonly_in_edit_mode = false;
		}
		$v_disabled_in_edit_mode = $formfield_row["disabled_in_edit_mode"];
		if ($v_type=="relaterecord"){
			$v_disabled_in_edit_mode = false;
		}
		if ($v_xml_str!=""){
			$column_rax = new RAX(); 
			$column_rec = new RAX();
			$column_rax->open($v_xml_str);
			$column_rax->record_delim = 'data_list';
			$column_rax->parse();
			$column_rec = $column_rax->readRecord(); 
			$column_row = $column_rec->getRow();
			$v_value = _restore_XML_bad_char($column_row[$v_xml_tag_in_db]); 
		}
		if ((!is_null($v_default_value) && $v_default_value!="")&&(is_null($v_value) || $v_value=="")){
			$v_value = $v_default_value;
		}
		if ($v_type=="selectbox"){
			$v_selectbox_option_sql = $formfield_row["selectbox_option_sql"];
			$v_selectbox_id_column = $formfield_row["selectbox_option_id_column"];
			$v_selectbox_name_column = $formfield_row["selectbox_option_name_column"];
		}
		if ($v_type=="checkboxmultiple"){
			$v_checkbox_multiple_sql = $formfield_row["checkbox_multiple_sql"];
			$v_checkbox_multiple_id_column = $formfield_row["checkbox_multiple_id_column"];
			$v_checkbox_multiple_name_column = $formfield_row["checkbox_multiple_name_column"];
		}
		$v_html_table = $v_html_table . "<col width='$v_first_col_width'>" . "<col width='$v_second_col_width'>";		
		$v_html_tag = $v_html_tag . Generate_HTML_Input();		
	}
	$v_html_string = $v_html_string .  $v_html_table . "<tr id = '$v_row_id' style='display:block'>" . "<td class='normal_label'>" . $v_html_tag."</td>";
	$v_html_string = $v_html_string . "</tr></table>";
	$table_struct_rec = $table_struct_rax->readRecord();
}
$v_html_string = $v_html_string . "</td></tr>";
//$v_html_string = $v_html_string . "<tr><td><hr width='100%' color='#66CCFF' size='1'></td></tr>";
//$v_html_string = $v_html_string . "<tr><td class='normal_label'><small class='normal_starmark'>".CONST_COMMITING_LABEL."</small>";
//$v_html_string = $v_html_string . "</td></tr>";  //Chu y co the dong bang o phia duoi kia
$v_html_string = $v_html_string . "<tr><td >";//Bat dau dong chua bang phe duyet ho so
echo $v_html_string;
//echo htmlspecialchars($v_html_string); exit;
if ($v_check_worktype == "APPROVING"){?>
<!-- THAO TAC DUYET HO SO QUA MANG-->
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<col width="22%"><col width="28%"><col width="31%"><col width="19%">
		<tr>
			<td colspan="4" ><hr color="#66CCFF" size="1"></td>
		</tr>
		<tr>
			<td class="normal_label"><?php echo CONST_APPROVING_LABEL; ?></td>
			<td class="normal_label" colspan="3"><input type="radio" name="rad_status" value="APPROVING" checked onclick="rad_onclick_approve_net(this,document.forms(0).hdn_approving_type);re_display_receiving_date();"><?php echo CONST_APPROVING_AGREE_LABEL;?></td>
		</tr>
		<tr>
			<td height="37"></td>
			<td class="normal_label" colspan="3"><input type="radio" name="rad_status" value="NOT_APPROVING" onclick="rad_onclick_approve_net(this,document.forms(0).hdn_approving_type);re_display_receiving_date();"><?php echo CONST_APPROVING_NOT_AGREE_LABEL;?></td>
		</tr>
		<tr>
			<td class='normal_label'> <?php echo CONST_WARNING_CONTENT_LABEL;?></td>
			<td colspan="3">&nbsp;&nbsp;&nbsp;<textarea name='txt_warning_content' class='normal_textarea' optional='true' style='width:97%' rows='3'></textarea></td>
		</tr>
		<tr id="tr_receiving_date">
			<td align="left" class="normal_label"><?php echo CONST_NET_RECORD_APPROVING_DATE_LABEL.":";?><small class="normal_starmark">*</small></td>
			<td colspan="3">&nbsp;&nbsp;
				<input type="text" name="txt_receiving_date" <?php echo $v_readonly;?> class="normal_date_textbox" isdate = "true" optional="<?php echo CONST_DATE_OPTIONAL; ?>" message = "<?php echo CONST_DATE_MESSAGE; ?>" value="<?php echo $v_date; ?>" onKeyDown="change_focus(document.forms(0),this);"><?php
				if ($v_record_work_id <= 0){?>
				<img src="<? echo $_ISA_IMAGE_URL_PATH;?>calendar.gif" border="0" onclick="DoCal('<?php echo $_ISA_LIB_URL_PATH; ?>isa-calendar/',document.forms(0).txt_receiving_date);" style="cursor:hand;"><?php
				}?>
			</td>		
		</tr>
	</table><?php 
}
////////////////////////////////////////////////////////////////////////////////////////////
if ($v_check_worktype == "OFFICIAL_RECEIVE"){?>
<!-- TIEP NHAN HO SO GOC-->
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<col width="18%"><col width="32%"><col width="31%"><col width="19%">
		<tr>
			<td colspan="4" ><hr color="#66CCFF" size="1"></td>
		</tr>
		<tr>
			<td class="normal_label"><?php echo CONST_RECEIVING_RECORD_STATUS_LABEL; ?></td>
			<td class='normal_label' colspan="3"><input type="radio" name="rad_status" value="NOT_OFFICIAL" checked onclick="rad_onclick_approve_net(this,document.forms(0).hdn_approving_type);re_display_receiving_date();re_display_official_receiving_date();"><?php echo CONST_NOT_OFFICIAL_LABEL;?></td>
		</tr>
		<tr>
			<td height="37"></td>
			<td class="normal_label" colspan="3"><input type="radio" name="rad_status" value="OFFICIAL" onclick="rad_onclick_approve_net(this,document.forms(0).hdn_approving_type);re_display_receiving_date();re_display_official_receiving_date();"><?php echo CONST_OFFICIAL_LABEL;?></td>
		</tr>
		<tr id="tr_official_receiving_date" style="display:none">
			<td align="left" class="normal_label"><?php echo CONST_OFFICIAL_DATE_LABEL;?><small class="normal_starmark">*</small></td>
			<td colspan="3">&nbsp;&nbsp;
				<input type="text" name="txt_official_receiving_date" <?php echo $v_readonly;?> class="normal_date_textbox" isdate = "true" optional="<?php echo CONST_DATE_OPTIONAL; ?>" message = "<?php echo CONST_DATE_MESSAGE; ?>" value="<?php echo $v_date; ?>" onKeyDown="change_focus(document.forms(0),this);"><?php
				if ($v_record_work_id <= 0){?>
				<img src="<? echo $_ISA_IMAGE_URL_PATH;?>calendar.gif" border="0" onclick="DoCal('<?php echo $_ISA_LIB_URL_PATH; ?>isa-calendar/',document.forms(0).txt_official_receiving_date);get_appoint_date(document.forms(0).txt_official_receiving_date,<?php echo $v_process_date?>,document.forms(0).txt_official_appointed_date,<?php echo $v_current_year?>);" style="cursor:hand;"><?php
				}?>
			</td>		
		</tr>
		<tr>
			<td style="display:none">
				<input type="text" name="txt_official_appointed_date" class="normal_date_textbox" isdate = "true" optional="<?php echo CONST_DATE_OPTIONAL; ?>" message = "<?php echo CONST_DATE_MESSAGE; ?>" value="<?php echo $v_date; ?>" onKeyDown="change_focus(document.forms(0),this);">
			</td>
		</tr>
	</table><?php 
}
//Ket thuc cua bang phia tren
echo "</td></tr></table>";
echo '<script language="JavaScript">'.$v_js_function.'</script>';
?>

<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
	<tr height="5pt"><td>&nbsp;</td></tr>
	<tr align="center">
		<td><?php 
		if ($v_check_worktype != "APPROVING" && $v_check_worktype != "OFFICIAL_RECEIVE"){
			if (($v_edit_mode==1||$v_customer_record_id<=0)&& $v_check_worktype != "APPROVED"){?>
				<input type='button' class='normal_button' name="btn_register" value='<?php echo CONST_REGISTER_BUTTON;?>' onClick="check_value_in_form();save_hidden_multiple_list(document.forms(0).chk_item_id,',');save_list_onclick(document.forms(0),document.forms(0).hdn_list_xml_tag,document.forms(0).hdn_list_xml_value);btn_save_onclick('UPDATE_CUSTOMER_RECORD');" onKeyDown="change_focus(document.forms(0),this)"><?php
			}if ($v_edit_mode==0 && $v_customer_record_id>0 && $v_status_of_receiving==0||$v_status_of_receiving==2){?>
				<input type='button' class='normal_button' name="btn_change" value='<?php echo CONST_CHANGE_BUTTON;?>' onClick="document.forms(0).hdn_edit_mode.value=1;check_value_in_form();save_hidden_multiple_list(document.forms(0).chk_item_id,',');save_list_onclick(document.forms(0),document.forms(0).hdn_list_xml_tag,document.forms(0).hdn_list_xml_value);btn_save_onclick('DISPLAY_SINGLE_CUSTOMER_RECORD');" onKeyDown="change_focus(document.forms(0),this)"><?php
			}if ($v_edit_mode==0 && $v_customer_record_id>0 && $v_status_of_receiving!=3){?>
				<input type='button' class='normal_button' name="btn_destroy" value='<?php echo CONST_DESTROY_BUTTON;?>' onClick="save_hidden_multiple_list(document.forms(0).chk_item_id,',');save_list_onclick(document.forms(0),document.forms(0).hdn_list_xml_tag,document.forms(0).hdn_list_xml_value);btn_delete_onclick('UPDATE_CUSTOMER_RECORD');" onKeyDown="change_focus(document.forms(0),this)"><?php
			}if ($v_check_worktype != "APPROVED"){?>
			<input type="button" name="btn_print" class="normal_button" value="<?php echo CONST_PETITION_PRINT_BUTTON; ?>" style="width:25%" onClick="save_hidden_multiple_list(document.forms(0).chk_item_id,',');save_list_onclick(document.forms(0),document.forms(0).hdn_list_xml_tag,document.forms(0).hdn_list_xml_value);btn_print_petition_onclick('../../record/customer/index.php','<?php echo $v_customer_record_id ?>','<?php echo $v_recordtype_filter ?>','PRINT_CUSTOMER_RECORD')"><?php
			}
		}if ($v_check_worktype == "APPROVING"){?>
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="check_value_in_form();save_hidden_multiple_list(document.forms(0).chk_item_id,',');btn_save_onclick('UPDATE_NET_RECORD_FOR_APPROVING');" onKeyDown="change_focus(document.forms(0),this)">
		<?php 
		}if ($v_check_worktype == "OFFICIAL_RECEIVE"){?>
			<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="check_value_in_form();save_hidden_multiple_list(document.forms(0).chk_item_id,',');save_list_onclick(document.forms(0),document.forms(0).hdn_list_xml_tag,document.forms(0).hdn_list_xml_value);btn_save_onclick('UPDATE_NET_RECORD_FOR_OFFICIAL_RECEIVE');" onKeyDown="change_focus(document.forms(0),this)">
		<?php 
		}?>
			<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>');" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
</table>
<!--//End//Form-->
</form>
<script language="JavaScript">
	if(test_tag("status_record")){
		//Neu dang trang thai la thieu HS thi khong cho tinh ngay tu dong tra ket qua cho cong dan nua.
		if(!document.forms(0).status_record.checked){
			get_appointed_date();
			show_hide_record();
		}else{
			get_appointed_date();
		}	
	}else{
		get_appointed_date();
	}	
	//cho an cac tag sau:status_record, get_minus_documnent, money_provisionally
	if(test_tag("status_record")){
		hide_row('status_record');
		hide_row('get_minus_documnent');
		hide_row('minus_documnent');
	}
	if(test_tag("money_provisionally")){
		hide_row('money_provisionally');
	}	
	//set_focus(document.forms(0));	
	function get_appointed_date(){
		<?php
			if ($v_check_worktype == "OFFICIAL_RECEIVE"){?>
				get_appoint_date(document.forms(0).txt_official_receiving_date,<?php echo $v_process_date?>,document.forms(0).txt_official_appointed_date,<?php echo $v_current_year?>);<?php
		}?>			
	}
</script>